# Maintainer: Bruno Pagani <archange@archlinux.org>
# Contributor: Eli Schwartz <eschwartz@archlinux.org>
# Contributor: Alex Filgueira <alexfilgueira (at antergos.com)>
# Contributor: Nate Simon <aurpkg (at natesimon.net)>

pkgname=xapp
pkgver=2.8.0
pkgrel=1
pkgdesc="Common library for X-Apps project"
arch=(loong64 x86_64)
url="https://github.com/linuxmint/${pkgname}"
license=(GPL)
depends=(libdbusmenu-gtk3 libgnomekbd)
optdepends=('python: for mate-desktop status applet')
makedepends=(meson samurai gobject-introspection python-gobject vala)
provides=(xapps)
conflicts=(xapps)
replaces=(xapps)
source=(${url}/archive/${pkgver}/${pkgname}-${pkgver}.tar.gz)
sha256sums=('7d060c533ff095c6560759c8e3e6ba7251085c7cad902d76a2ff196f1eb84a79')
b2sums=('23c45f55913b0b3817143305b1f5896ace62f7aec961dad18cfb0526c0e972c00b59c009a42e7e48a6f376306942069b878d2bcf98002feb482e2744399db6a8')

build() {
  arch-meson ${pkgname}-${pkgver} build \
    --buildtype=debugoptimized
# https://github.com/linuxmint/xapp/issues/169
  samu -C build
}

package(){
  DESTDIR="${pkgdir}" samu -C build install

  # byte-compile python modules since meson does not implement autotools’ py-compile.
  local site_packages=$(python -c "import site; print(site.getsitepackages()[0])")
  python -m compileall -o 0 -o 1 -o 2 --hardlink-dupes -s "${pkgdir}" "${pkgdir}"${site_packages}
}
